/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
 */

// 导入依赖
const terser = require('@rollup/plugin-terser');
const commonjs = require('@rollup/plugin-commonjs');
const { nodeResolve } =require('@rollup/plugin-node-resolve');
const json = require('@rollup/plugin-json');

// tsconfig.json合并选项

module.exports = {
  // 项目入口
  input: './src/wrapper/hvigor-wrapper.js',

  // 打包后的出口和设置
  output: {
    file: './src/wrapper/script/hvigor/hvigorw.js',
    format: 'cjs',
    sourcemap: false,
    compact: true
  },

  plugins: [nodeResolve(), commonjs({
    ignoreDynamicRequires: true
  }), json(), terser({
    format:{
      // if、for、do、while 或 with 语句中插入大括号，即使它们的主体是单个语句
      braces:true,

      // 美化输出, 使压缩后的代码格式更容易读取
      beautify:true,
    }
  })],
};
